home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 2.9 KB | 102 lines |
- package symantec.itools.awt.util;
-
-
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- import java.awt.LayoutManager;
- import symantec.itools.awt.BorderPanel;
- import symantec.itools.awt.BevelStyle;
-
- // 01/29/97 TWB Integrated changes from Windows
-
- /**
- * ToolBarPanel component.
- * This component creates a panel to which you can add buttons to create a toolbar
- * in a window. Toolbars commonly contain buttons, but a ToolBarPanel can hold
- * other types of components like static text, check boxes, even images.
- *
- * Tool bar components are separated with a ToolBarSpacer component.
- *
- * @see symantec.itools.awt.util.ToolBarSpacer
- *
- * @version 1.0, Nov 26, 1996
- * @author Symantec
- */
-
-
- public class ToolBarPanel
- extends BorderPanel
- {
- /**
- * Create ToolBarPanel. Default ToolBarPanel uses a BEVEL_RAISED style.
- */
-
- public ToolBarPanel()
- {
- super.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- setBevelStyle(BevelStyle.BEVEL_RAISED);
- }
-
- /**
- * Takes no action.
- * This is a standard Java AWT method which gets called to specify
- * which layout manager should be used to layout the components in
- * standard containers.
- *
- * Since layout managers CANNOT BE USED with this container the standard
- * setLayout has been OVERRIDDEN for this container and does nothing.
- *
- * @param l the layout manager to use to layout this container's components
- * (IGNORED)
- * @see java.awt.Container#getLayout
- **/
- public void setLayout(LayoutManager lm)
- {
- }
-
- /**
- * Returns the recommended dimensions to properly display this component.
- * This is a standard Java AWT method which gets called to determine
- * the recommended size of this component.
- *
- * @see #minimumSize
- */
- public synchronized Dimension preferredSize()
- {
- Dimension s = new Dimension(0, 20);
- Component[] list = ((Container)super).getComponents();
-
- for (int i = 0; i < list.length; ++i) {
- Dimension cs = list[i].size();
- s.width += cs.width;
- s.height = Math.max(s.height, cs.height);
- }
-
- if (s.width == 0)
- s.width = 50;
-
- s.width += (padleft + padright + ixPad * 2);
- s.height += (getLabelTopMargin() + padbottom + iyPadTop + iyPadBottom) + 1;
-
- return s;
- }
-
- /**
- * Returns the minimum dimensions to properly display this component.
- * This is a standard Java AWT method which gets called to determine
- * the minimum size of this component.
- *
- * In this case the minimum size is the same as the preferred size.
- *
- * @see #preferredSize
- */
- public synchronized Dimension minimumSize()
- {
- return preferredSize();
- }
- }
-
-